package operation;

import book.Book;
import book.Booklist;

import java.util.Scanner;

public class AddOperation implements IOPeration {
    public void work(Booklist booklist){
        System.out.println("新增图书.。。。。");

        if(booklist.isFull()){
            return ;
        }

        System.out.println("请输入要新增的书名");
        Scanner scanner =new Scanner(System.in);
        String bookName=scanner.nextLine();
        System.out.println("请输入书的作者");
        String author=scanner.nextLine();
        System.out.println("请输入书的价格");
        int price=scanner.nextInt();
        System.out.println("请输入书的类型");
        String type=scanner.nextLine();

        Book book=new Book(bookName,author,price,type);

        int currentSize= booklist.getUsedSize();
        booklist.setBook(currentSize,book);
        booklist.setUsedSize(currentSize+1);
        System.out.println("新增图书成功");


    }
}
